package com.carpedil.redis.controller;

import com.carpedil.redis.entity.CityEntity;
import com.carpedil.redis.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/** @author Administrator */
@RestController
public class CityController {
  @Autowired CityService cityService;

  @GetMapping("/cities/{username}/{city}")
  public List<CityEntity> findCities(
      @PathVariable("username") String username, @PathVariable("city") String city) {
    List<CityEntity> list = null;
    try {
      list = cityService.findByUserNameAndDateTime(username, city);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    return list;
  }
}
